home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0769A.ZIP
/
LINES.C
< prev
next >
Wrap
Text File
|
1987-11-11
|
1KB
|
44 lines
/* Last revision: April 22, 1987 at 09:24 */
/**************************************************************************/
#include <extend.h>
#define LF '\n'
#define SOFT_LF ('\n' | 0x80)
/*************************************************************
* LINES()
* Syntax: LINES( <expC> ) where expC is the memo field
*
* Return: The number of lines in the memo field. Essentially,
* this routine counts up all soft line feeds and line feeds
*
* Note..: compile with Lattice >LC -ml -v -n LINES
*
*/
LINES()
{
unsigned char *_str_all();
unsigned char *str1; /* string and a pointer into it */
int linecount;
if (PCOUNT >= 1 && ISCHAR(1)) {
str1 = _parc(1);
if (strlen (str1) > 0)
linecount = 1;
else
linecount = 0;
while (*str1)
{
if (*str1 == LF || *str1 == SOFT_LF )
linecount++;
str1++;
}
_retni (linecount);
}
else
_retni (-1); /* error situation */
}